package com.hx.vending.controller;

import com.hx.vending.bean.SubsidiaryRole;
import com.hx.vending.bean.UserOperation;
import com.hx.vending.service.IUserOperationService;
import com.hx.vending.util.Msg;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by Administrator on 2019/3/13.
 */
@Controller
@RequestMapping("/operation")
public class UserOperationController {

    @Resource
    private IUserOperationService userOperationService;


    /**
     * 查询权限列表
     * @return
     */
    @RequestMapping("/selectOperationList")
    @ResponseBody
    public Msg selectOperationList () {

        return this.userOperationService.selectOperationList();
    }


    /**
     * 添加权限
     * @param userOperation
     * @return
     */
    @RequestMapping("/insertUserOperation")
    @ResponseBody
    public Msg insertUserOperation (UserOperation userOperation) {

        return this.userOperationService.insertUserOperation(userOperation);
    }


    /**
     * 根据角色岗位查询拥有权限
     * @param subsidiaryRole
     * @return
     */
    @RequestMapping("/selectOperationByRole")
    @ResponseBody
    public Msg selectOperationByRole(SubsidiaryRole subsidiaryRole) {

        return this.userOperationService.selectOperationByRole(subsidiaryRole);
    }
}
